package com.lch.netty.bio;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;

/**
 * @author: liuchenhui
 * @create: 2019-10-10 14:31
 **/
public class BIOClient {
    public static void main(String[] args) {
        try {
            Socket socket  = new Socket("localhost", 8088);

            OutputStream outputStream = socket.getOutputStream();
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream, "UTF-8");
            PrintWriter writer = new PrintWriter(outputStreamWriter, true);

            Scanner scanner = new Scanner(System.in);
            while (true) {
                writer.println(scanner.nextLine());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
